package cn.iocoder.yudao.module.member.dal.mysql.scorelevel;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.scorelevel.vo.ScoreLevelExportReqVO;
import cn.iocoder.yudao.module.member.controller.admin.scorelevel.vo.ScoreLevelPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.scorelevel.ScoreLevelDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 积分等级 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ScoreLevelMapper extends BaseMapperX<ScoreLevelDO> {

    default PageResult<ScoreLevelDO> selectPage(ScoreLevelPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ScoreLevelDO>()
                .eqIfPresent(ScoreLevelDO::getCode, reqVO.getCode())
                .likeIfPresent(ScoreLevelDO::getName, reqVO.getName())
                .orderByDesc(ScoreLevelDO::getId));
    }

    default List<ScoreLevelDO> selectList(ScoreLevelExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ScoreLevelDO>()
                .eqIfPresent(ScoreLevelDO::getCode, reqVO.getCode())
                .likeIfPresent(ScoreLevelDO::getName, reqVO.getName())
                .orderByDesc(ScoreLevelDO::getId));
    }

}
